<include file="Public:header" />
<div class="container">
	<div class="page-header">
		<h4><a name="tab">{:L('BUSINESS_DETAILS')}</a></h4>
	</div>
	<include file="Public:alert"/>
	<div class="row">
		<div class="tabbable span12">
			<ul class="nav nav-tabs">
				<li><a href="#tab1">{:L('BASIC_INFORMATION')}</a></li>
				<li><a href="#tab7">{:L('CONTRACT')}({$business['contract_count']})</a></li>
				<li><a href="#tab8">{:L('THE_ACCOUNTS_RECEIVABLE')}({$business['receivables_count']})</a></li>
				<li><a href="#tab9">{:L('The_accounts_payable')}({$business['payables_count']})</a></li>
				<li><a href="#tab2">{:L('PRODUCT')}({$business['product_count']})</a></li>
				<li><a href="#tab3">{:L('COMMUNICATION_LOGS')}({$business['log_count']})</a></li>
				<li><a href="#tab4">{:L('TASK')}({$business['task_count']})</a></li>
				<li><a href="#tab5">{:L('SCHEDULE')}({$business['event_count']})</a></li>
				<li><a href="#tab6">{:L('ATTACHMENT')}({$business['file_count']})</a></li>
			</ul>
			<div class="tab-content">
					<table class="table table-hover">
						<thead>
							<tr> 
								<td colspan="4">
									<p style="font-size: 14px;">
										<if condition="$business['is_deleted'] == 0">
											<a href="javascript:void(0);" class="advance">{:L('BOOST')}</a> | 
											<a href="{:U('business/edit', 'id='.$business['business_id'])}">{:L('COMPILE')}</a> | 
											<a href="javascript:void(0);" class="add_product">{:L('ADD_PRODUCT')}</a> | 
											<a href="javascript:void(0);" class="add_log">{:L('ADD_THE_COMMUNICATION_LOG')}</a> | 
											<a href="javascript:void(0);" class="add_task">{:L('ADD_TASKS')}</a> | 
											<a href="javascript:void(0);" class="add_event">{:L('ADD_THE_SCHEDULE')}</a> | 
											<a href="javascript:void(0);" class="add_file">{:L('ADD_ATTACHMENT')}</a> | 
											<a href="{:U('business/delete', 'id='.$business['business_id'])}" class="del_confirm">{:L('DELETE')}</a> | 	
											<a href="javascript:void(0)" onclick="javascript:history.go(-1)">{:L('RETURN')}</a>
										<else />
											<a href="javascript:void(0)" onclick="javascript:history.go(-1)">{:L('RETURN')}</a>
										</if>
									</p>
								</td>
							</tr>
						</thead>
                        <tbody>
							<tr><th colspan="4">{:L('BASIC_INFORMATION')}</th></tr>
							<if condition="$business['is_deleted'] eq 1">
								<tr>
									<td class="tdleft">{:L('DELETE_THE_PEOPLE')}</td>
									<td><a class="role_info" href="javascript:void(0)" rel="{$business.deleted.role_id}">{$business.deleted.user_name}</a></td>
									<td class="tdleft" width="15%">{:L('DELETE_THE_TIME')}</td>
									<td>{$business.delete_time|date='Y-m-d H:i:s',###}</td>
								</tr>
							</if>
							<tr>
								<td class="tdleft">{:L('PRINCIPAL')}</td>
								<td><a class="role_info" href="javascript:void(0)" rel="{$business.owner.role_id}">{$business.owner.user_name}</if></a></td>
								<td class="tdleft" width="15%">{:L('CREATION_TIME')}</td>
								<td><if condition="$business['create_time'] neq 0">{$business.create_time|date='Y-m-d H:i:s',###}</if></td>
							</tr>
							<tr>
								<td class="tdleft" width="15%">{:L('THE_ADVANCE_OF_TIME')}</td>
								<td><if condition="$business['update_time'] neq 0">{$business.update_time|date='Y-m-d H:i:s',###}<else />{:L('NOT_AVAILABLE')}</if></td>
                            <php>$j=0;</php>
                            <volist name="field_list" id="vo">
                            <php>$j++;</php>
                            <if condition="$vo['form_type'] == 'textarea' or $vo['form_type'] == 'editor'">
                                <if condition="$i%2 != 0">
                                <td colspan="2">&nbsp;</td>
                                </tr>
                                </if>
                                <tr>
                                    <td class="tdleft" width="15%">{$vo.name}:</td>
                                    <td colspan="3">{$business[$vo['field']]}</td>
                                </tr>
                                <if condition="$i%2 == 0 && count($field_list) != $j">
                                <php>$i++;</php>
                                </if>
                            <else/>
                                <if condition="$i%2 == 0">
                                <tr>
                                </if>
                                    <td class="tdleft" width="15%">{$vo.name}:</td>
                                    <td width="35%">
                                        <span style="color:#{$vo['color']}">
                                        <if condition="$vo['form_type'] eq 'datetime'">
                                            <if condition="$business[$vo['field']] gt 0">{$business[$vo['field']]|date='Y-m-d',###}</if>
                                        <elseif condition="$vo['field'] eq 'customer_id'"/>
                                            <a href="{:U('customer/view','id='.$business['customer_id'])}">{$business['customer']['name']}</a>
                                        <elseif condition="$vo['field'] eq 'contacts_id'"/>
                                            {$business['contacts']['name']}
                                        <elseif  condition="$business[$vo['field']]"/>
                                            {$business[$vo['field']]}
                                        </if>
                                        </span>
                                    </td>
                                <if condition="$i%2 != 0">
                                </tr>
                                </if>
                                <if condition="$i%2 == 0 && count($field_list) == $j">
                                    <td colspan="2">&nbsp;</td>
                                </tr>
                                </if>
                            </if>
                            </volist>
						</tbody>
					</table>
					<h5>{:L('PROMOTE_THE_HISTORY')}</h5>
					<table class="table table-hover">
						<if condition="$business.bsList eq null">
							<tr>
								<th>{:L('THERE_IS_NO_DATA')}</th>
							</tr>
						<else />
						<thead>
							<tr>
								<th>{:L('TIME')}</th>
								<th>{:L('PHASE')}</th>								
								<th>{:L('STAGE_OF_DESCRIPTION')}</th>
								<th>{:L('PRINCIPAL')}</th>
							</tr>
						</thead>
						<tbody>
							<volist name="business.bsList" id="vo">
							<tr>
								<td width="10%">
									<if condition="$vo['update_time'] neq 0">
										{$vo.update_time|date="Y-m-d H:i",###}
									<else />
										{$business.create_time|date='Y-m-d H:i',###}</if>
								</td>
								<td>{$vo.status_name}</td>
								<td>{$vo.description}</td>
								<td><notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty></td>
								
							</tr>
							</volist>
						</tbody>
						</if>
					</table>
                    <a name="tab7"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('THE_RELEVANT_CONTRACT')}</th>
                        </tr>
                    </table>
					<table class="table table-hover">
						<if condition="$business.contract eq null">
							<tr>
								<td>{:L('THERE_IS_NO_DATA')}</td>
							</tr>
						<else /> 
							<tr>
								<td width="10%">&nbsp;</td>
								<td>{:L('CONTRACT_NO')}</td>
								<td>{:L('SIGNING_TIME')}</td>
								<td>{:L('OFFER')}</td>
								<td>{:L('PRINCIPAL')}</td>
								<td>{:L('CREATION_TIME')}</td>
							</tr>
							<volist name="business.contract" id="vo">
								<tr>
									<td class="tdleft"><if condition="$business['is_deleted'] == 0"><a target="_blank" href="{:U('contract/view','id='.$vo['contract_id'])}">{:L('CHECK')}</a> &nbsp; <a target="_blank" href="{:U('contract/edit','id='.$vo['contract_id'])}">{:L('COMPILE')}</a></if></td>
									<td>
										<a target="_blank" href="{:U('contract/view','id='.$vo['contract_id'])}">{$vo.number}</a>
									</td>									
									<td><notempty name="vo.due_time">{$vo.due_time|date="Y-m-d",###}</notempty></td>
									<td>
										{$vo.price}
									</td>
									<td>
										<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty>
									</td>
									<td><notempty name="vo.create_time">{$vo.create_time|date="Y-m-d",###}</notempty></td>
								</tr>
							</volist>
						</if>
						<if condition="$business['is_deleted'] == 0">
							<tr>
								<td colspan="6">
									<a href="javascript:void(0);" class="add_contract">{:L('ADD')}</a>
								</td>
							</tr>
						</if>
					</table>
                    <a name="tab8"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('THE_ACCOUNTS_RECEIVABLE')}</th>
                        </tr>
                    </table>
                    <table class="table">
                        <if condition="$business.receivables eq null">
                            <tr>
                                <td>{:L('THERE_IS_NO_DATA')} </td>
                            </tr>
                        <else /> 
                        <thead>
                            <tr>
                                <td>&nbsp;</td>
                                <td>{:L('THE_ACCOUNTS_RECEIVABLE_NAME')}</td>
                                <td>{:L('CONTRACT')}</td>
                                <td>{:L('STATE')}</td>
                                <if condition="C('ismobile') neq 1">
                                <td>{:L('MONEY')}</td>
                                <td>{:L('PRINCIPAL')}</td>
                                </if>
                            </tr>
                        </thead>
                        <tbody>
                            <volist name="business.receivables" id="vo">
                                <tr>
                                    <td class="tdleft"><a href="{:U('finance/view', 't=receivables&id='.$vo['receivables_id'])}">{:L('CHECK')}</a></td>
                                    <td>
                                        <a href="{:U('finance/view', 't=receivables&id='.$vo['receivables_id'])}">{$vo.name}</a>
                                    </td>
                                    <td>
                                        <a href="{:U('contract/view', 'id='.$vo['contract_id'])}">{$vo.contract_name}</a>
                                    </td>
                                    <td>
                                        <if condition="$vo['status'] eq 2">{:L('HAS_BEEN_RECEIVING')}<elseif condition="$vo['status'] eq 1" />{:L('PART_OF_THE_RECEIVED')}<else />{:L('DID_NOT_RECEIVE_PAYMENT')}</if>
                                    </td>
                                    <if condition="C('ismobile') neq 1">
                                    <td>
                                        <if condition="$vo['price'] gt 0">{$vo.price}</if>
                                    </td>
                                    <td>
                                        <notempty name="vo.owner.user_name">
                                        <a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a>
                                        </notempty>
                                    </td>
                                    </if>
                                </tr>
                            </volist>
                        </tbody>
                    </if>
                        <tr>
                            <td <if condition="C('ismobile') neq 1">colspan="6"<else/>colspan="4"</if>>
                                <if condition="$business['is_deleted'] == 0">
									<a target="_blank" href="{:U('finance/add','t=receivables&bid='.$business['business_id'])}">{:L('ADD')}</a>
								</if>
                            </td>
                        </tr>
                    </table>
                    <a name="tab9"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('The_accounts_payable')}</th>
                        </tr>
                    </table>
					<table class="table">
                        <if condition="$business.payables eq null">
                            <tr>
                                <td>{:L('THERE_IS_NO_DATA')} </td>
                            </tr>
                        <else /> 
                        <thead>
                            <tr>
                                <td>&nbsp;</td>
                                <td>{:L('THE_ACCOUNTS_PAYABLE_NAME')}</td>
                                <td>{:L('CONTRACT')}</td>
                                <td>{:L('STATE')}</td>
                                <if condition="C('ismobile') neq 1">
                                <td>{:L('MONEY')}</td>
                                <td>{:L('PRINCIPAL')}</td>
                                </if>
                            </tr>
                        </thead>
                        <tbody>
                            <volist name="business.payables" id="vo">
                                <tr>
                                    <td class="tdleft"><a href="{:U('finance/view', 't=payables&id='.$vo['payables_id'])}">{:L('CHECK')}</a></td>
                                    <td>
                                        <a href="{:U('finance/view', 't=payables&id='.$vo['payables_id'])}">{$vo.name}</a>
                                    </td>
                                    <td>
                                        <a href="{:U('contract/view', 'id='.$vo['contract_id'])}">{$vo.contract_name}</a>
                                    </td>
                                    <td>
                                        <if condition="$vo['status'] eq 2">{:L('PAYMENT_HAS_BEEN')}<elseif condition="$vo['status'] eq 1" />{:L('PART_OF_THE_PREPAID')}<else />{:L('NOT_PAYING')}</if>
                                    </td>
                                    <if condition="C('ismobile') neq 1">
                                    <td>
                                        <if condition="$vo['price'] gt 0">{$vo.price}</if>
                                    </td>
                                    <td>
                                        <notempty name="vo.owner.user_name">
                                        <a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a>
                                        </notempty>
                                    </td>
                                    </if>
                                </tr>
                            </volist>
                        </tbody>
                        </if>
                        <tr>
                            <td <if condition="C('ismobile') neq 1">colspan="6"<else/>colspan="4"</if>>
                                <if condition="$business['is_deleted'] == 0">
									<a target="_blank" href="{:U('finance/add','t=payables&bid='.$business['business_id'])}" >{:L('ADD')}</a>
								</if>
                            </td>
                        </tr>
                    </table>
                   <!-- 产品 -->
					<a name="tab2"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('RELATED_PRODUCTS')}</th>
                        </tr>
                    </table>
					<table class="table table-bordered" id="no-input-border" width="95%" border="0" cellspacing="1" cellpadding="0">
						<tbody>
							<if condition="$business.product eq null">
								<tr>
									<td>{:L('THERE_IS_NO_DATA')} </td>
								</tr>
							<else /> 
							<tr style="background-color:#E0E8FF;text-align:center;">
								<td class="span2">产品</td>
								<td>数量</td>
								<td>单价</td>
								<td>折扣率(%)</td>
								<td>税率(%)</td>
								<td>小计</td>
								<td>备注</td>
							</tr>
							
							<volist name="business.product" id="vo">
								<tr>
									<td>{$vo.info.name}</td>
									<td>{$vo.amount}</td>
									<td>{$vo.unit_price}</td>
									<td>{$vo.discount_rate}</td>
									<td>{$vo.tax_rate}</td>
									<td>{$vo.subtotal}</td>
									<td>{$vo.description}</td>
								</tr>
							</volist>
							<tr style="background-color:#FFFFF3">
								<td>合计</td>
								<td>{$total_amount}</td>
								<td></td>
								<td></td>
								<td></td>
								<td colspan="2">{$vo.subtotal_val}</td>
							</tr>
							<tr style="background-color:#FFFFF1">
								<td>其他费用</td>
								<td>{$vo.discount_price}</td>
								<td></td>
								<td></td>
								<td>最终费用</td>
								<td colspan="2">{$vo.sales_price}</td>
							</tr>
							</if>
						</tbody>
					</table>
                    <a name="tab3"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('COMMUNICATION_LOGS')}</th>
                        </tr>
                    </table>
					<table class="table">
						<if condition="$business.log eq null">
							<tr>
								<td>{:L('THERE_IS_NO_DATA')}</td>
							</tr>
						<else />
							<volist name="business.log" id="vo">
								<tr>
									<td>
										<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty> &nbsp; 
										{$vo.create_date|date="Y-m-d  g:i:s a",###} &nbsp; 
										<notempty name="vo.create_date"> &nbsp; </notempty>
										<if condition="C('ismobile') eq 1"><br/></if>
										{$vo.subject}
									</td>
									<td>
										<if condition="$business['is_deleted'] neq 1"><a href="javascript:void(0)" rel="{$vo.log_id}" class="edit_log">{:L('COMPILE')}</a>&nbsp; <a href="{:U('log/delete','r=RBusinessLog&id='.$vo['log_id'])}" class="del_confirm">{:L('DELETE')}</a></if>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<if condition="strlen($vo['content']) gt 100">
											<div id="slog_{$vo.log_id}">
											<pre>{$vo.content|msubstr=###,0,100}
											<a class="more" rel="{$vo.log_id}" href="javascript:void(0)">{:L('READ_MORE')}</a></pre>
											</div>
											<div id="llog_{$vo.log_id}" class="hide">
												<pre>{$vo.content}</pre>
											</div>
										<else/>
											<pre>{$vo.content}</pre>
										</if>
									</td>
								</tr>
							</volist>
						</if>
						<if condition="$business['is_deleted'] neq 1">
							<tr>
								<td colspan="2">
									<a href="javascript:void(0);" class="add_log">{:L('ADD')}</a>
								</td>
							</tr>
						</if>
					</table>
                    <a name="tab4"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('RELATED_TASKS')}</th>
                        </tr>
                    </table>
					<table class="table">
						<if condition="$business.task eq null">
							<tr>
								<td>{:L('THERE_IS_NO_DATA')} </td>
							</tr>
						<else /> 
							<tr>
								<td>&nbsp;</td>
								<td>{:L('THEME')}</td>
								<td>{:L('STATE')}</td>
								<td>负责人</td>
								<td>任务相关人</td>
								<td>{:L('DUE_DATE')}</td>
								<td>{:L('MODIFICATION_TIME')}</td>
							</tr>
							<volist name="business.task" id="vo">
								<tr>
									<td class="tdleft" width="10%">
										<if condition="$business['is_deleted'] == 0"><a href="{:U('task/view','id='.$vo['task_id'])}">{:L('CHECK')}</a>&nbsp; <a href="{:U('task/delete','id='.$vo['task_id'])}" class="del_confirm">{:L('DELETE')}</a>
										<if condition="$vo.isclose eq 0"><a href="{:U('task/close','id='.$vo['task_id'])}">{:L('CLOSE')}</a><elseif condition="$vo.isclose eq 1" /><a href="{:U('task/open','id='.$vo['task_id'])}">{:L('OPEN')}</a> </if>
										</if>
									</td>
									<td>
										{$vo.subject}
									</td>
									<td>
										{$vo.status}
									</td>
									<td>
										<notempty name="vo.owner"><volist name="vo.owner" id="v"><a class="role_info" rel="{$v.role_id}" href="javascript:void(0)">{$v.user_name}</a>,</volist></notempty>
									</td>
									<td>
										<notempty name="vo.about_roles"><volist name="vo.about_roles" id="v"><a class="role_info" rel="{$v.role_id}" href="javascript:void(0)">{$v.user_name}</a>,</volist></notempty>
									</td>
									<td>
										<notempty name="vo.due_date">{$vo.due_date|date="Y-m-d g:i:s a",###}</notempty>
									</td>
									<td>
										<notempty name="vo.update_date">{$vo.update_date|date="Y-m-d g:i:s a",###}</notempty>
									</td>
								</tr>
							</volist>
						</if>
						<if condition="$business['is_deleted'] == 0">
							<tr>
								<td colspan="5">
									<a href="javascript:void(0);" class="add_task">{:L('ADD')}</a>
								</td>
							</tr>
						</if>
					</table>
                    <a name="tab5"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('RELATED_SCHEDULE')}</th>
                        </tr>
                    </table>
					<table class="table">
						<if condition="$business.event eq null">
							<tr>
								<td>{:L('THERE_IS_NO_DATA')} </td>
							</tr>
						<else /> 
							<tr>
								<td>&nbsp;</td>
								<td>{:L('THEME')}</td>
								<td>{:L('SITE')}</td>
								<td>{:L('PRINCIPAL')}</td>
								<td>{:L('THE_START_TIME')}</td>
								<td>{:L('THE_END_TIME')}</td>
							</tr>
							<volist name="business.event" id="vo">
								<tr>
									<td class="tdleft" width="10%">
										<if condition="$business['is_deleted'] == 0">
										<a href="{:U('event/view', 'id='.$vo['event_id'])}">{:L('CHECK')}</a>&nbsp; <a href="{:U('event/delete', 'id='.$vo['event_id'])}" class="del_confirm">{:L('DELETE')}</a>&nbsp; 
										<if condition="$vo.isclose eq 0"><a href="{:U('event/close', 'id='.$vo['event_id'])}">{:L('CLOSE')}</a><elseif condition="$vo.isclose eq 1" /><a href="{:U('event/open','id='.$vo['event_id'])}">{:L('OPEN')}</a> </if>
										</if>
									</td>
									<td>
										{$vo.subject}
									</td>
									<td>
										{$vo.venue}
									</td>
									<td>
										<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty>
									</td>
									<td>
										<notempty name="vo.start_date">{$vo.start_date|date="Y-m-d g:i:s a",###}</notempty>
									</td>
									<td>
										<notempty name="vo.end_date">{$vo.end_date|date="Y-m-d g:i:s a",###}</notempty>
									</td>
								</tr>
							</volist>
						</if>
						<if condition="$business['is_deleted'] == 0">
							<tr>
								<td colspan="6">
									<a href="javascript:void(0);" class="add_event">{:L('ADD')}</a>
								</td>
							</tr>
						</if>
					</table>
                    <a name="tab6"></a><div style="height:40px;"></div>
                    <table class="table table-hover">
                        <tr>
                            <th>{:L('THE_RELEVANT_DOCUMENTS')}</th>
                        </tr>
                    </table>
					<table class="table table-hover">
						<if condition="$business.file eq null">
							<tr>
								<td>{:L('THERE_IS_NO_DATA')} </td>
							</tr>
						<else /> 
							<tr>
								<td>&nbsp;</td>
								<td>{:L('FILENAME')}</td>
								<td>{:L('SIZE')}</td>
								<td>{:L('ADDER')}</td>
								<td>{:L('ADDTIME')}</td>
							</tr>
							<volist name="business.file" id="vo">
								<tr>
									<td class="tdleft">
										<if condition="$business['is_deleted'] == 0">
											<a href="{:U('file/delete', 'r=RBusinessFile&id='.$vo['file_id'])}" class="del_confirm">{:L('DELETE')}</a>
										</if>
									</td>
									<td>
										<a target="_blank" href="{$vo.file_path}">{$vo.name}</a>
									</td>
									<td>
										{$vo.size}{:L('BYTE')}
									</td>
									<td>
										<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty>
									</td>
									<td>
										<notempty name="vo.create_date">{$vo.create_date|date="Y-m-d g:i:s a",###}</notempty>
									</td>
								</tr>
							</volist>
						</if>
						<if condition="$business['is_deleted'] == 0">
							<tr>
								<td colspan="5">
									<a href="javascript:void(0);" class="add_file">{:L('ADD')}</a>
								</td>
							</tr>
						</if>
					</table>
			</div>
		</div>
	</div>
</div>
<div class="hide" id="dialog-file" title="{:L('ADD_ATTACHMENT')}">loading...</div>
<div class="hide" id="dialog-log" title="{:L('ADD_THE_LOG')}">loading...</div>
<div class="hide" id="dialog-log-edit" title="{:L('EDIT_LOG')}">loading...</div>
<div class="hide" id="dialog-task" title="{:L('ADD_TASKS')}">loading...</div>
<div class="hide" id="dialog-event" title="{:L('ADD_THE_SCHEDULE')}">loading...</div>
<div class="hide" id="dialog-product" title="{:L('ADD_PRODUCT')}">loading...</div>
<div class="hide" id="dialog-edit" title="{:L('MODIFY_BUSINESS_PRODUCT_INFORMATION')}">loading...</div>
<div class="hide" id="dialog-role-info" title="{:L('Employee_information')}">loading...</div>
<div class="hide" id="dialog-contract" title="{:L('ADD_THE_CONTRACT')}">loading...</div>
<div class="hide" id="dialog-advance" title="{:L('OPPORTUNITIES_TO_ADVANCE')}">loading...</div>
<script type="text/javascript">
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>

$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-advance").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-contract").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-file").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-log").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-task").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	position: ["center",100]
});
$("#dialog-event").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-log-edit").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-product").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-edit").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$(".add_file").click(function(){
	$('#dialog-file').dialog('open');
	$('#dialog-file').load('{:U("file/add", "r=RBusinessFile&module=business&id=".$business["business_id"])}');
});
$(".add_log").click(function(){
	$('#dialog-log').dialog('open');
	$('#dialog-log').load('{:U("log/add", "r=RBusinessLog&module=business&id=".$business["business_id"])}');
});
$(".edit_log").click(function(){
	$log_id = $(this).attr('rel');
	$('#dialog-log-edit').dialog('open');
	$('#dialog-log-edit').load('{:U("log/edit","id=")}'+$log_id);
});
$(".add_task").click(function(){
	$('#dialog-task').dialog('open');
	$('#dialog-task').load('{:U("task/add","r=RBusinessTask&module=business&id=".$business["business_id"])}');
});
$(".add_event").click(function(){
	$('#dialog-event').dialog('open');
	$('#dialog-event').load('{:U("event/add","r=RBusinessEvent&module=business&id=".$business["business_id"])}');
});
$(".add_product").click(function(){
	$('#dialog-product').dialog('open');
	$('#dialog-product').load('{:U("product/adddialog","r=RBusinessProduct&module=business&id=".$business["business_id"])}');
});
$(".edit_product").click(function(){
	id = $(this).attr('rel');
	$('#dialog-edit').dialog('open');
	$('#dialog-edit').load('{:U("product/editdialog","r=RBusinessProduct&id")}'+id);
});
$(".role_info").click(function(){
	$role_id = $(this).attr('rel');
	$('#dialog-role-info').dialog('open');
	$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
});
$(".add_contract").click(function(){
	$('#dialog-contract').dialog('open');
	$('#dialog-contract').load('{:U("contract/add","business_id=")}'+{$business.business_id});
});
$(".advance").click(function(){
	$('#dialog-advance').dialog('open');
	$('#dialog-advance').load('{:U("business/advance","id=".$business["business_id"])}');
});
$(".more").click(function(){
	log_id = $(this).attr('rel');
	$('#llog_'+log_id).attr('class','');
	$('#slog_'+log_id).attr('class','hide');
});
</script>
<include file="Public:footer" />	